﻿<UserControl 
    x:Class="Sidvall.UI.Wpf.Controls.CheckBoxListControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:local="clr-namespace:Sidvall.UI.Wpf.Controls" 
    mc:Ignorable="d" 
    d:DesignHeight="100" d:DesignWidth="300">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <Grid x:Name="Label" Grid.Row="0" Visibility="Collapsed"
              Margin="{Binding LabelMargin, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:CheckBoxListControl}}}" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <ContentControl Grid.Column="0"
                            Content="{Binding LabelLeftContent, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:CheckBoxListControl}}}"
                            Focusable="False" />
            <TextBlock Grid.Column="1" TextWrapping="Wrap"
                       Text="{Binding LabelText, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:CheckBoxListControl}}}" />
            <ContentControl Grid.Column="2"
                            Content="{Binding LabelRightContent, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:CheckBoxListControl}}}"
                            Focusable="False" />
        </Grid>
        <StackPanel x:Name="StackPanel" Grid.Row="1"
                    Orientation="{Binding ItemOrientation, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:CheckBoxListControl}}}" >
        </StackPanel>
    </Grid>
</UserControl>
